package com.springboot.cloud.sysadmin.organization.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.springboot.cloud.sysadmin.organization.entity.po.Dept;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * Created by ZengJian on 2021/2/3 0003 上午 9:22
 */
@Repository
@Mapper
public interface DeptMapper extends BaseMapper<Dept> {

    @Select("select d.id from dept d,user_dept_relation ud where  d.id=ud.dept_id and ud.user_id=#{user_id}")
      String getDepts(@Param("user_id") String user_id);

    @Select("select rd.dept_id from dept d,role_dept_relation rd where   d.id=rd.dept_id and   rd.role_id=#{role_id}")
      String getRoleDepts(@Param("role_id") String role_id);
}
